let union:string|number;
union=2;
union='hello';

let union2:number|string|boolean|string[];

function merge(
    n1:number|string,
    n2:number|string,
    resultType:'as-number'|'as-string'
){
    if(resultType === 'as-string'){
        return n1.toString()+n2.toString();
    }else{
        return Number(n1)+Number(n2);
    }
}
let mergeNumber=merge(2,3,'as-number');
let mergeString=merge(2,3,'as-string');
console.log(mergeNumber,mergeString);

let union3:0|1|2;
union3=1;
let literal:1|'2'|true|[1,2,3,4];
